//
//  PresentComplexViewController.m
//  UIViewControllerTransitionDemo
//
//  Created by Guo Rui on 2017/7/3.
//  Copyright © 2017年 GR Harry. All rights reserved.
//

#import "PresentComplexViewController.h"
#import "PresentComplexImageViewController.h"
#import "PresentComplexAnimator.h"

@interface PresentComplexViewController ()<UIViewControllerTransitioningDelegate>

@end

@implementation PresentComplexViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (IBAction)presentAction:(id)sender {
    // 两个单独的viewcontroller进行转场，动画由被推出的控制器决定。
    PresentComplexImageViewController *imageViewController = [[PresentComplexImageViewController alloc] init];
    imageViewController.transitioningDelegate = self;
    [self presentViewController:imageViewController animated:YES completion:nil];
}

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
                                                                  presentingController:(UIViewController *)presenting
                                                                      sourceController:(UIViewController *)source {
    return [[PresentComplexAnimator alloc] initWithDismiss:NO];
}

@end
